<?php
require_once($server->my_site[0]->path.$server->my_site[0]->folder."distributor_manage.php");

$distributor->id or exit("Área reservada a distribuidores");

// First we search for if the order is in the distributor arrays
$myorder=null;
foreach ($distributor->unprocessed_orders as $order) {
	if ($order->id==$_GET['order_id']) {
		$myorder=$order;
		break;
	}
}
if (!$myorder) {
	foreach ($distributor->processed_orders as $order) {
		if ($order->id==$_GET['order_id']) {
			$myorder=$order;
			break;
		}
	}
}
?>
<div style="margin: 1em 0;">
<?php
  if ($order->status < 2) {
	exit("Error: La orden ".$order->id." no ha sido procesada anteriormente");
  }
  else {
$order->status='1';
$order->db_update_status();

?>
<p>Estado cambiado a <?php echo $order->status; ?>.</p>
</div>
<?php
}
?>
<script language="javascript">
	reload("#orders","?section=orders");
</script>

